<?php
	session_start();
	ob_start();
	function __autoload($TenLop)
	{
		include_once "classes/" . $TenLop . ".php";
	}
	include_once "thuvien.php";
?>
<!DOCTYPE html>
<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		
		<title>Web Shop Hoa</title>
		<link rel="stylesheet" type="text/css" href="css/styles.css">
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
		 <script type="text/javascript" src="scripts/ckeditor/ckeditor.js"></script>
		<script type="text/javascript" src="scripts/ckfinder/ckfinder.js"></script>
        
         <script type="text/javascript" src="scripts/jquery.min.js"></script>
        <script type="text/javascript" src="scripts/stickytooltip.js"></script>
        <link rel="stylesheet" type="text/css" href="css/stickytooltip.css" />
        
        <script type="text/javascript" src="scripts/jquery.js"></script>
	<script type="text/javascript">

	$(document).ready(function () {

		$('#dropdown').hover(
		
			function () {

				//change the background of parent menu				
				$('#dropdown li a.parent').addClass('hover');
				
				//display the submenu
				$('#dropdown ul.children').show();
				
			},
		
			function () {

				//change the background of parent menu
				$('#dropdown li a.parent').removeClass('hover');			

				//display the submenu
				$('#dropdown ul.children').hide();
				
			}
		
		);
		
	});
	

	</script>
	
	<style type="text/css">
	body {
		font-family:arial;	
	}
	
	a {
		text-decoration:none;
		color:#666;
	}
	
	a:hover {
		color:#e11;	
	}
	
	#dropdown {
		/* cancel the default list style */
		list-style:none;
		margin:0;
		padding:0;
		width:180px;
		position:relative;
	}
	
	#dropdown li {
	}
	
	#dropdown li a.parent {
		display:block; 
		width:180px; height:40px;
		font-weight:700;
		padding:0 0 0 10px;
		line-height:35px;
		background:url(images/parent.gif) 0px 0px no-repeat;
	}
	
	#dropdown li a.hover {
		background:url(images/parent.gif) 0px -40px no-repeat;	
	}
	
		#dropdown ul {
			
			/* cancel the default list style */
			margin:0;
			padding:0;
			list-style:none;	
			display:none;
			
			/* make sure it has the highest z-index */
			position:absolute;
			left:0;
			z-index:500;
			background:#fff;
			width:180px;
			background:url(images/child.gif) left bottom no-repeat;
		}
		
			#dropdown ul li {
				font-size:13px;	
			}
			
				#dropdown ul li a {
					display:block; 
					font-weight:700;
					padding:0 0 0 10px;
					height:30px;
					color:#fff;
				}
				
				#dropdown ul li a:hover {
					color:#e11	
				}
	</style>
	<link rel="stylesheet" href="css/flexslider.css" type="text/css" media="screen" />
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
  	<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.min.js">\x3C/script>')</script>
	<!-- FlexSlider -->
  <script defer src="scripts/jquery.flexslider.js"></script>

  <script type="text/javascript">
    $(function(){
      SyntaxHighlighter.all();
    });
    $(window).load(function(){
      $('.flexslider').flexslider({
        animation: "slide",
        start: function(slider){
          $('body').removeClass('loading');
        }
      });
    });
  </script>
	<!-- Modernizr -->
  <script src="scripts/modernizr.js"></script>
  
  <!-- Syntax Highlighter -->
  <script type="text/javascript" src="scripts/shCore.js"></script>
  <script type="text/javascript" src="scripts/shBrushXml.js"></script>
  <script type="text/javascript" src="scripts/shBrushJScript.js"></script>

  <!-- Optional FlexSlider Additions -->
  <script src="scripts/jquery.easing.js"></script>
  <script src="scripts/jquery.mousewheel.js"></script>
  <script defer src="scripts/demo.js"></script>
	</head>

	<body>
		<div id="main">
				<div class="top">
					<div class="languages">
						<div>Languages : </div>
						<a href="#"><img src="images/en.jpg" alt="EN"></a>
						<a href="#"><img src="images/dn.jpg" alt="DE"></a>
					</div>
					<div class="search">
						<div class="search_text"><a href="#">Advanced Search</a></div>
						<input type="text" class="search_input" name="search">
						<input type="image" src="images/search.jpg" class="search_bt">
					</div>
				</div>
				<div class="clr"></div>
			<div class="header">
					<section class="slider">
                        <div class="flexslider">
                          <ul class="slides">
                             <?php
								$sanpham = new sanphambs();
								$danhsach = $sanpham->GetList_New();
								for($i = 0; $i < ($danhsach == false ? 0 : 5) ; $i++)
								{
									$hinhanh = new hinhanhbs();
									$hinhanh->MaSanPham = $danhsach[$i]['MaSanPham'];
									$dshinh = $hinhanh->GetList();
									 echo " <li>
				 <div class='slider_hinhsp'><a href='san-pham-chi-tiet-".$danhsach[$i]['MaSanPham']."'>
					<img src='{$dshinh[0]['patch']}' width='220px' height='240px'/>
				 </a>
				 </div>
					
				 <div class='slider_thongtinsp'>
				 <h2 class='TenSP'>". $danhsach[$i]['TenSanPham']."</h2>
					
				 <table>
				 	
					<tr> <td><span class='thongtin_sp'>Nhóm hàng: </span></td><td>". $danhsach[$i]['TenNhomHang']."</td></tr>
					<tr> <td><span class='thongtin_sp'>Loại hàng: </span></td><td>". $danhsach[$i]['TenLoai']."</td></tr>
					<tr> <td><span class='thongtin_sp'> Xuất xứ:</span></td><td>". $danhsach[$i]['TenNhaSX']."</td></tr>
					<tr> <td><span class='thongtin_sp'> Giá: </td><td><span class='GiaBan'> " . number_format($danhsach[$i]['DonGia']) . " VNĐ</span></td>
				 </table>
				 
				 <p class='XemTiep'><a href='san-pham-chi-tiet-" . $danhsach[$i]['MaSanPham'] . "'>Chi tiết</a> " . $danhsach[$i]['LuotXem'] . " lượt xem</p>
				 </div>
				</li>";
								}
							?>
                         
                           </ul>
                        </div>
                     </section>
			</div>
					<div class="clr"></div>
			<div id="content">
						
						<div class="clr"></div>
			<!----------------------------LEFT CONTENT------------------------>           
						 <div id="left_content">
							<ul id="dropdown">
                                <li><a href="trangchu" class="parent">Danh mục &raquo;</a>	
                                    <ul class="children">
                                       <?php
                                       		$nhomhang = new nhomhangbs();
											$dmnhomhang = $nhomhang->GetList();
											for($i = 0; $i < count($dmnhomhang); $i++)
											{
												echo "<li><a href='index.php?do=sanpham_timkiem&mnh=".$dmnhomhang[$i]['MaNhomHang']."'> ".$dmnhomhang[$i]['TenNhomHang']."</a></li>";
											}
									   ?>
                                    </ul>
                                </li>
                            </ul>
							<div class="title_box">TÌM KIẾM</div>
								<ul class="left_menu">
									<form action="index.php?do=home_timkiem" method="post" class="timkiemsp">
                                        Sản phẩm cần tìm: <input type="text" style="width:150px;" name="tkhoa" />
                                        <select name="loai" class="timkiem">
                                            <option value='0'>Sản phẩm</option>
                                            <option value='1'>Nhà sản xuất</option>
                
                                            <option value='2'>Loại sản phẩm</option>
         
                                            <option value='3'>Nhóm hàng</option>
                                        </select>
                                        <input type="submit" value="Tìm kiếm" name="TimKiem" class="btn_timkiem" />
                                    </form>
								</ul>
								<div class="title_box">Tài khoản</div>
                                <ul class="left_menu">
                                            <?php
                                            if(!isset($_SESSION['MaNguoiDung']))
                                            {
                                                echo '<li class="odd"><a href="dangnhap">Đăng nhập</a</li>';
                                                echo '<li class="even"><a href="dangky">Đăng ký</a></li>
                                                      <li class="odd"><a href="dangxuat">Quên mật khẩu</a></li>';
                                        
                                            }
                                            else
                                            {																		
                                                    echo'<li class="odd"><a href="doimatkhau">Đổi mật khẩu</a></li>
                                                        <li class="even" ><a href="hosocanhan">Hồ sơ cá nhân</a></li>
                                                        <li class="odd"><a href="nguoidung">Người dùng</a></li>
                                                        <li class="even"><a href="dangxuat">Đăng xuất</a></li>';
                                            }
                                    ?>
								</ul>
						</div>
						
                      
			<!----------------------------CENTER CONTENT------------------------> 
						<div id="center_content">
							<div id="noidung">
								<?php
									$do = isset($_GET['do']) ? $_GET['do'] : "home";
									include $do . ".php";
								?>
							</div>	
						</div>
						
				<!----------------------------RIGHT CONTENT------------------------>            
						<div id="right_content">
		
								<?php
								if(!isset($_SESSION['MaNguoiDung']))
								{
									
								}
								else
								{
									if($_SESSION['QuyenHan']==1)
									{
										echo'
								<div class="title_box">Sản phẩm</div>
								<ul class="right_menu">
													<li class="odd"><a href="loaisp">Loại sản phẩm</a></li>
													<li class="even"><a href="nhasanxuat">Nhà sản xuất</a></li>
													<li class="odd"><a href="nhomhang">Nhóm hàng</a></li>
													<li class="even"><a href="sanpham">Sản phẩm</a></li>
											 </ul>';
									}
									
								echo '<div class="title_box">Giỏ Hàng</div>';
								echo'<ul class="right_menu">
											<li class="odd"><a href="giohang">Giỏ hàng</a></li>
											<li class="even"><a href="lsmuahang">Lịch sử mua hàng</a></li>
									</ul>';
									
								}
							?>
							
						</div>	
					</div>
					<div class="clr"></div>
					<div class="footer">
						<div class="link">
							Copyright © 2014 &nbsp;•&nbsp; Design by Nguyễn Thị Ngọc Hiền &nbsp;•&nbsp; E-mail: <a href="mailto:dth114096@gmail.com">dth114096@gmail.com</a>.&nbsp;•&nbsp;website : <a href="website:dth114096-webshophoa890m.com">dth114096-webshophoa.890m.com</a>
						</div>
					</div>
				<div id="divAdLeft" style="DISPLAY: none; POSITION: absolute; TOP: 0px">   
        	<img src="images/c3cxfu8hgwdnpdbym9h9.gif" width="125px" />  
            
		</div>     
		<div id="divAdRight" style="DISPLAY: none; POSITION: absolute; TOP: 0px">     
		  		<img src="images/banner_f.png" width="125px" />  
		</div> 
    
   		 <script>     
			function FloatTopDiv()     
			{     
				startLX = ((document.body.clientWidth -MainContentW)/2)-LeftBannerW-LeftAdjust , startLY = TopAdjust+80;     
				startRX = ((document.body.clientWidth -MainContentW)/2)+MainContentW+RightAdjust , startRY = TopAdjust+80;     
				var d = document;     
				function ml(id)     
				{     
					var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];    
					el.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';};     
					el.x = startRX;     
					el.y = startRY;     
					return el;     
				}     
				function m2(id)     
				{     
					var e2=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];     
					e2.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';};     
					e2.x = startLX;     
					e2.y = startLY;     
					return e2;     
				}     
				window.stayTopLeft=function()     
				{     
					if (document.documentElement && document.documentElement.scrollTop)     
						var pY =  document.documentElement.scrollTop;     
					else if (document.body)     
						var pY =  document.body.scrollTop;     
					 if (document.body.scrollTop > 30){startLY = 3;startRY = 3;} else  {startLY = TopAdjust;startRY = TopAdjust;};     
					ftlObj.y += (pY+startRY-ftlObj.y)/16;     
					ftlObj.sP(ftlObj.x, ftlObj.y);     
					ftlObj2.y += (pY+startLY-ftlObj2.y)/16;     
					ftlObj2.sP(ftlObj2.x, ftlObj2.y);     
					setTimeout("stayTopLeft()", 1);     
				}     
				ftlObj = ml("divAdRight");     
				//stayTopLeft();     
				ftlObj2 = m2("divAdLeft");     
				stayTopLeft();     
			}     
			function ShowAdDiv()     
			{     
				var objAdDivRight = document.getElementById("divAdRight");     
				var objAdDivLeft = document.getElementById("divAdLeft");       
				if (document.body.clientWidth < 1000)     
				{     
					objAdDivRight.style.display = "none";     
					objAdDivLeft.style.display = "none";     
				}     
				else     
				{     
					objAdDivRight.style.display = "block";     
					objAdDivLeft.style.display = "block";     
					FloatTopDiv();     
				}     
			} 
		</script>     
		<script>     
			document.write("<script type='text/javascript' language='javascript'>MainContentW = 1000;LeftBannerW = 125;RightBannerW = 125;LeftAdjust = 5;RightAdjust = 5;TopAdjust = 180;ShowAdDiv();window.onresize=ShowAdDiv;;<\/script>");     
		</script>
		
	
</body>
</html>